(define defmacro
  (macro _ parameters
    (pattern (id params (:rest body)) parameters
      (let (($params (fresh)))
	`(define ,id (macro ,id ,$params
		       (pattern ,params ,$params
			 ,@body)))))))

(define defmacro*
  (macro _ parameters
    (pattern (id params (:rest body)) parameters
      (let (($params (fresh)))
	`(define ,id (macro ,id ,$params
		       (pattern ,params ,$params
			 ,@body)))))))

(defmacro defun (id params (:rest body))
  (let (($params (fresh)))
    `(define ,id
       (fixpoint ,id ,$params
	 (pattern ,params ,$params
	   ,@body)))))

(defmacro fix (id params (:rest body))
  (let (($params (fresh)))
    `(fixpoint ,id ,$params
       (pattern ,params ,$params
         ,@body))))

(defmacro lambda (params (:rest body))
  (let (($id (fresh)))
    `(fix ,$id ,params (seq ,@body))))

(defmacro when (condition (:rest body))
  `(if ,condition (seq ,@body) ()))

(defun +1 (x)
  (+ 1 x))
